package com.dawson.gitosc;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;

import com.dawson.gitosc.ui.MainActivity;

public class WelcomeActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View mView = new View(this);
        mView.setBackgroundResource(R.mipmap.git_start);
        setContentView(mView);

        //渐变展示启动屏
        AlphaAnimation aa = new AlphaAnimation(0.3f, 1.0f);//透明度
        aa.setDuration(2000);//动画持续时间
        mView.startAnimation(aa);//启动动画
        aa.setAnimationListener(new mAnimationListener());
    }

    /**
     * Animation动画监听事件
     */
    private class mAnimationListener implements Animation.AnimationListener{
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            //动画结束
            startActivity(new Intent(getApplication(), MainActivity.class));
            finish();
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    }
}